const { app, BrowserWindow } = require('electron')
app.commandLine.appendSwitch('ignore-certificate-errors');
function createWindow () {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: false,
      nodeIntegrationInWorker: false
    }
  })

  var url = "https://note.youdao.com/web";
  if(process.argv.length > 2){
    url = process.argv[2];
  }
  win.loadURL(url);
  win.maximize();
  // win.webContents.openDevTools();
}

app.whenReady().then(createWindow)

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', () => {
  if (BrowserWindow.getAllWindows().length === 0) {
    createWindow()
  }
})
